package com.ruoyi.pay.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;

/**
 * @ClassName AliPayConfig
 * @Author 周政
 * @create 2023/2/7 0007 16:56
 */
public class AliPayConfig {
    /**
     * 网关地址
     **/
    public static final String PAY_GATEWAY = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
    /**
     * 支付宝 APPID
     **/
    public static final String APPID = "9021000135631223";
    /*
     * 应用私钥
     **/
    public static final String APP_PRI_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv7UKePADZk8AUam/CGAOovFpZDfOU2By81FIXW4wpZWa7A9u4Nq2jvYD+HJiS7HpTSiVjSz0qnbol2soOKvB3kSZBbXjnsryqs+QJ4T5VDXGuSKluBaKL4TDdeYlQt/GTH19Z9i2x8/RDbI0AHJ6Xi+2RY6Iaqe+0BmHp2G1RIRWMwVgYNi6RwtTpt5TK599T9Dw53qBIgjnzQ2lSnE3oNbHraKJtpbz9WwzwZEhDiWd7v8Pi7Mk3kAiKqUan0lrIOt0Xcv95auF9V0ZwkuS+IWSAmcRAvY8887ZRYiEEunRuESK/GR6VPf02Bmj8gBcz+ctaK4yIbTS7Kuy1swyfAgMBAAECggEAG2AaG7FOmIzLOOIPHe7KsvkMPgtTufefESsg0w2l09M5lyRUjmfDwVT9u40LmOE/b7J7+uV8USNWEgnnoyi/XnuxrkCwra08enufooHwRx/ebrZT1xD9aDLUfcIpweu9pZ0eI0uRdL13Zv5/OmM5sm9Num/8i5Wh/St5FQBekl8HRxQ0pUxkMU+OI+L1WP4lVEn8/gPIgBqJBwQbpYje+ph/jyt8AmFCzeCzne6lrl5rF4u4r2DHpqYKVFhq28sXKBhsCMkLGzYMAT+hhqLiKmktrNnSlZEB5OY7CVca1Iq5JvwBDDy7aaweZxi+vE2h74SnJBh8sqvRnm0aLHF8cQKBgQDnQIZ5+t5EDX8eYvDgVw7TqaUvYOP1+zahCOj04mZXSGPm1ilrvqRpmDOoF+i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fEmAxx3hxM3LUenoKW1PSBLBzTquka2E1nniARb6i4b80Fm4YsUv3F/HfFVItU2VjLqzuraIQISlwQ4vCHpc2w7OP+uaqkws7VYqliAqgWRa/mHHcwVFYuaAK1QJfGqJ7pW4Yu3BOTUyas/23RuyeXsQu3iBeRagdQIDAQAB";
    /**
     * 商户生成签名
     **/
    public static final String SIGN_TYPE = "RSA2";
    /**
     * 字符编码
     **/
    public static final String CHARSET = "UTF-8";
    /**
     * 返回参数
     **/
    public static final String FORMAT = "json";

    private AliPayConfig() {
    }

    private volatile static AlipayClient instance = null;

    /**
     * 单例模式获取，双重检查校验
     **/
    public static AlipayClient getInstance() {
        if (instance == null) {
            synchronized (AliPayConfig.class) {
                if (instance == null) {
                    instance = new DefaultAlipayClient(PAY_GATEWAY, APPID, APP_PRI_KEY, FORMAT, CHARSET, APP_PUB_KEY, SIGN_TYPE);
                }
            }
        }
        return instance;
    }
}
